<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
    function changeImage()
    {
    element=document.getElementById('myimage')
    if (element.src.match("bulbon"))
    {
        element.src="bulboff.jpg";
    }
    else
    {
        element.src="bulbon.jpg";
    }
}
    
//  三元表达式
//  function changeImage(){
//  var s = document.getElementById('myimage');
//  s.src = s.src.match('bulboff')?"/images/pic_bulbon.gif":"/images/pic_bulboff.gif";
//}
    
    
</script>
<img id="myimage" onclick="changeImage()" src="bulbon.jpg" width="200" height="180">
	</body>
</html>
